<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>全部订单</title>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
        ">
        <meta http-equiv="Access-Control-Allow-Origin" content="*" />
        <link rel="stylesheet" href="lib/weui.min.css">
        <link rel="stylesheet" href="css/jquery-weui.css">
        <link rel="stylesheet" href="css/style.css">
        <link rel="stylesheet" href="css/fonts/font-awesome.min.css">
        <link rel="stylesheet" href="css/ui-box.css">
        <link rel="stylesheet" href="css/ui-base.css">
        <link rel="stylesheet" href="css/ui-color.css">
        <link rel="stylesheet" href="css/appcan.icon.css">
        <link rel="stylesheet" href="css/appcan.control.css">
        <link rel="stylesheet" href="lib/weui.min.css">
        <link rel="stylesheet" href="css/jquery-weui.css">
        <link rel="stylesheet" href="css/style.css">
    </head>
    <body ontouchstart>

        <div id="header" class="uh bc-text-head ub bc-head ">
            <!--<div class="nav-btn" id="nav-left"></div>-->
            <div class="nav-btn" id="nav-left" onclick="closeWin()">
                <div class="fa fa-angle-left fa-2x"></div>
            </div>
            <h1 class="ut ub-f1 ulev-3 ut-s tx-c" tabindex="0">AppCan</h1>
            <div class="nav-btn" id="nav-right">
                <!--按钮开始-->

                <!--按钮结束-->
            </div>
        </div>
        <div class='weui-content'>
            <div class="weui-tab">
                <div class="weui-navbar" style="  left:0; right:0;  background:#fff;">
                    <a class="weui-navbar__item proinfo-tab-tit font-14 weui-bar__item--on" id="type1" onclick="change(1,this)" href="javascript:void(0)">全部</a>
                    <a class="weui-navbar__item proinfo-tab-tit font-14"  id="type2" onclick="change(2,this)" href="javascript:void(0)">待付款</a>
                    <a class="weui-navbar__item proinfo-tab-tit font-14"  id="type3"  onclick="change(3,this)" href="javascript:void(0)">待发货</a>
                    <a class="weui-navbar__item proinfo-tab-tit font-14"    id="type4" onclick="change(4,this)" href="javascript:void(0)">待收货</a>
                    <a class="weui-navbar__item proinfo-tab-tit font-14"   id="type5" onclick="change(5,this)" href="javascript:void(0)">待评价</a>
                </div>
                <div class="weui-tab__bd proinfo-tab-con">
                    <div id="tab1" class="weui-tab__bd-item weui-tab__bd-item--active">

                    </div>
                    <div class="weui-loadmore" id="show">
                        <i class="weui-loading"></i>
                        <span class="weui-loadmore__tips">正在加载</span>
                    </div>
                </div>
            </div>
        </div>

        <!--

        <div class="weui-loadmore weui-loadmore_line">
        <span class="weui-loadmore__tips">暂无数据</span>
        </div>
        <div class="weui-loadmore weui-loadmore_line weui-loadmore_dot">
        <span class="weui-loadmore__tips"></span>
        </div>

        -->
        <script src="js/appcan.js"></script>
        <script src="js/appcan.control.js"></script>
        <script src="js/common.js"></script>
        <script src="lib/jquery-2.1.4.js"></script>
        <script src="lib/fastclick.js"></script>
        <script>
            $(function() {
                FastClick.attach(document.body);
            });
        </script>
        <script src="js/jquery-weui.js"></script>
        <script>
            var status = true;
            var type =common.getCache("type");
            var page = 1;
            function change(type,obj){
                changeMenu(obj);
                page = 1;
                type = type;
                $("#tab1").html("");
                init(page); 
            }
            $("#show").show();
            function changeMenu(obj) {
            $(".weui-bar__item--on").removeClass("weui-bar__item--on")
            $(obj).addClass("weui-bar__item--on")
            }


            $(document).on("click", ".ords-btn-dele", function() {
            $.confirm("您确定要删除此订单吗?", "确认删除?", function() {
            $.toast("订单已经删除!");
            }, function() {
            //取消操作
            });
            });

            $(document).on("click", ".receipt", function() {
            $.alert("五星好评送蓝豆哦，赶快去评价吧！", "收货完成！");
            });
            //滚动条到页面底部加载更多案例
            $(window).scroll(function(){
             var scrollTop = $(this).scrollTop();    //滚动条距离顶部的高度
             var scrollHeight = $(document).height();   //当前页面的总高度
             var clientHeight = $(this).height();    //当前可视的页面高度
             // console.log("top:"+scrollTop+",doc:"+scrollHeight+",client:"+clientHeight);
             if(scrollTop + clientHeight >= scrollHeight){   //距离顶部+当前高度 >=文档总高度 即代表滑动到底部 count++;         //每次滑动count加1
             console.log(status)
            if(status == "false"){
            console.log("不执行")
            return;
            }else{
            status=false;
            $("#show").show();
            page++;
            init(page)
            }
             ;
            }else if(scrollTop<=0){
             //滚动条距离顶部的高度小于等于0 TODO
             //alert("下拉刷新，要在这调用啥方法？");
             }
            });
            function run(data){

            console.log("加载数据")
            $("#show").hide();
            $("#tab1").append(data);;
            status=true;
            }
            var orderError = function error(data){
            console.log(1111)
            console.log(data)
            alert(JSON.stringify(data));
            }
            function init(page){
            status=false;
            common.ajax(common.server+"/api-shop/shop/list.do",null,{start:page,status:type},run,orderError,"html")

            }
            function initpage(){
               $(".weui-bar__item--on").removeClass("weui-bar__item--on")
                $("#type"+type).addClass("weui-bar__item--on")
                
                init(page);
            }
            initpage();
        </script>
    </body>
</html>
